package com.gcxy.controller;

import com.gcxy.conf.result.R;
import com.gcxy.dto.LoginUserDTO;
import com.gcxy.service.IUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private IUserService userService;

    /**
     * 登录
     * @return
     */
    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public R login(@Validated @RequestBody LoginUserDTO loginUserDTO){
        return userService.login(loginUserDTO);
    }

    /**
     * 退出登录
     * @return
     */
    @PostMapping("/logout")
    public R logout(){
        return R.Success();
    }

    @PostMapping("/getCurrentUser")
    public R getCurrentUser(){
        return R.Success();
    }
}
